package com.yuyu.tt.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.scheduling.annotation.EnableAsync;

@Configuration
@EnableAsync
public class SimpleAsyncConfig {

    // 每次单开一个线程处理
    @Bean(name = "simpleAsyncExec")
    public SimpleAsyncTaskExecutor taskExecutor() {
        return new SimpleAsyncTaskExecutor();  // 每次新开线程
    }
}

